from forms.models import Form, Field
from django.db import models
from django.contrib.auth.models import User

class Application(models.Model):
    STATUS_CHOICES = (
        ('A', 'Acepted'),
        ('R', 'Rejected'),
        ('P', 'Pending'),        
    )
    sender = models.ForeignKey(User)
    form = models.ForeignKey(Form)
    submission_date = models.DateTimeField(blank=True, null=True)
    open_date = models.DateTimeField(blank=True, null=True)
    status = models.CharField(max_length=1, choices=STATUS_CHOICES, blank=True, null=True)
    
    def __unicode__(self):
        return self.form.title
    
class ApplicationValue(models.Model):
    application = models.ForeignKey(Application)
    field = models.ForeignKey(Field)
    value = models.TextField(max_length=200, blank=True)
    feedback = models.TextField(max_length=200, blank=True)
    checked = models.BooleanField()